package com.example.hissys.mapper;

import com.example.hissys.entity.Department;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * 科室数据访问层
 * @author Your Name
 * @since 2025-01-03
 */
@Mapper
public interface DepartmentMapper {
    /**
     * 根据医院ID查询所有部门
     * @param hospitalId 医院ID
     * @return 部门列表
     */
    @Select("SELECT * FROM departments WHERE hospital_id = #{hospitalId}")
    List<Department> findByHospitalId(Integer hospitalId);

    /**
     * 根据ID查询科室
     * @param id 科室ID
     * @return 科室信息
     */
    @Select("SELECT * FROM departments WHERE id = #{id}")
    Department findById(Integer id);


} 